package com.example.bnuzzu.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.bnuzzu.common.dto.HouseListDto;
import com.example.bnuzzu.common.dto.UserListDto;
import com.example.bnuzzu.entity.Userinfo;
import com.example.bnuzzu.mapper.HouseinfoMapper;
import com.example.bnuzzu.mapper.UserinfoMapper;
import com.example.bnuzzu.service.UserinfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author BNUZZU
 * @since 2021-04-13
 */
@Service
public class UserinfoServiceImpl extends ServiceImpl<UserinfoMapper, Userinfo> implements UserinfoService {
    @Autowired
    UserinfoMapper userinfoMapper;
    @Override
    public IPage<UserListDto> selectUserPage(Page<UserListDto> page, Integer state) {
        page.setOptimizeCountSql(false);
        return userinfoMapper.selectPageVo(page, state);
    }

    @Override
    public List<Userinfo> getAllUser() {
        return userinfoMapper.getAllUser();
    }

    @Override
    public List<UserListDto> findFriends(Integer houseid) {
        return userinfoMapper.findFriends(houseid);
    }
}
